
--local gMaxSlotCount=10

local M={}

-- function M.Calculate(bro)
--     local upCount,upkey=M.Calculate_upgrade(bro)
--     local seCount,sekey=M.Calculate_sell(bro)
--     bro["power"]=M.Calculate_power(bro)
--     bro["nextPower"]=M.Calculate_nextPower(bro)
--     bro["upgrade"]={[upkey]=upCount}
--     bro["sell"]={[sekey]=seCount}
--     return bro
-- end

-- function M.Calculate_power(oneBro)
--     return 200+(oneBro.level)*200
-- end
-- function M.Calculate_nextPower(oneBro)
--     return 200+(oneBro.level)*300
-- end
-- function M.Calculate_upgrade(oneBro)
--     return 10,"base_meat"
-- end

-- function M.Calculate_sell(oneBro)
--     return 10,"base_meat"
-- end

function M.Calculate_Cost(costString)
    for k,v in pairs(costString) do
       return  k,v
    end
end
function M.Split_ItemData(string)
     local car, id = string:match("^(car)_(.+)$")
     return car, id
end
function M.Add_ItemData(string,count)--品阶+1
    local a,b = string:match("^(%d+)_(%d+)")
    local new = tonumber(b) + count  

-- 拼接新值
    local newValue = a .. "_" .. new
    return newValue
end


--能否装备  1：槽位已经满，2，去购买槽位，3 未知错误
function M.IsCanEquip(idList,equip,broSlot)
    -- local add=#idList
    -- local now=#equip
    -- local count=broSlot
    -- if now+add<=count then
    --     return 0
    -- end
    -- if broSlot<gMaxSlotCount then
    --     return 2
    -- end
    -- return 1
end



--能否制作遗物
function M.IsCanMakeRecipe(costString,dataBase)
   
    local  key,sum=M.Calculate_Cost(costString)
    if  _G.CommonOHOH.load.ItemTool().IsHadEnough(key,sum,dataBase) then
        return 0,sum,key
    else
        return 1
    end

end




return M